﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Database.Model.TechnicRequests>" %>
<%--<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Models.TechnicRequests>" %>--%>

<%@ Import Namespace="CRM.Resourses" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Заявка №  <%:Model.IdTechnicRequest.ToString()%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<%
    var usersCol = new CRM.Database.Model.UsersCollection();
    var addressesCol = new CRM.Database.Model.AddressesCollection();
    var leCol = new CRM.Database.Model.LegalEntitiesCollection();
    var contactsCol = new CRM.Database.Model.ContactsCollection();
%>

<h2>Заявка №  <%:Model.IdTechnicRequest.ToString()%>     Статус: <%if (Model.TechnicRequestStatuses!=null) {%> <%:Model.TechnicRequestStatuses.LocalizedName%> <%}%> </h2>

Менеджер: <b><%:Model.ManagerName %></b>;   Кл-я: <b><%:Model.CustomerClassificationByTurnover %></b>;   Клиент: <b><%= Html.ActionLink(Model.CustomerName, "Details", "Customers", new { id = Model.IdCustomer.ToString() }, null)%></b>
<br />




<%= Html.ActionLink("Изменить", "TechnicRequestEdit", new { idRequest = Model.IdTechnicRequest })%> |   
<%= Html.ActionLink("Вернуться к списку заявок", "TechnicRequests")%> | 
<%= Html.ActionLink("Сформировать отчет", "MakeReport", new { idRequest = Model.IdTechnicRequest })%> |
<%= Html.ActionLink("Анализировать отчет", "AnalyseReport", new { idRequest = Model.IdTechnicRequest })%>
<br />
<%= Html.ActionLink("Просмотреть анализированный отчет", "ViewReport", new { idRequest = Model.IdTechnicRequest })%> |
<%= Html.ActionLink("Загрузить отчет еще раз", "InsertCompletedReport", new { idRequest = Model.IdTechnicRequest })%> 

<% Html.RenderPartial("TechnicRequestsDatesPartial"); %>

<%-- <br />--%>

 <table>
    <tr>
        <td>
            <%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Дата выезда";
    settings.Width = 162;
}).GetHtml()%>
            <%:Html.DevExpress().DateEdit(settings =>
{
    settings.ReadOnly = true;
    settings.Name = "PlannedDate";
    settings.Properties.DisplayFormatString = "D";
    settings.Width = 162;
}).Bind(Model.PlannedDate).GetHtml()%>
        </td>
        <td>
            <%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Техник";
    settings.Width = 162;
}).GetHtml()%>
            <%Html.DevExpress().ComboBox(settings =>
              {
                  settings.ReadOnly = true;
                  settings.Name = "IdTechnic";
                  settings.Properties.ValueType = typeof(int);
                  settings.Properties.TextField = "LocalizedFullName";
                  //settings.Properties.TextField = "UserFullNameRu";
                  settings.Width = 162;
                  settings.Properties.ValueField = "IdUser";
              }).BindList(usersCol.Technics).Bind(Model.IdTechnic).GetHtml();%>
             <%-- }).BindList(DB.GetUsersByIdRoleType(3)).Bind(Model.IdTechnic).GetHtml();%>--%>
        </td>
        <td>
            <%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = Resourses.TechnicDuration;
    settings.Width = 162;
}).GetHtml()%>
            <%:Html.DevExpress().SpinEdit(settings =>
{
    settings.ReadOnly = true;
    settings.Name = "Duration";
    settings.Properties.DisplayFormatString = "N1";
    settings.Properties.Increment = (decimal)0.1;
    settings.Width = 162;
}).Bind(Model.Duration).GetHtml()%>
        </td>
    </tr>
 </table>
 
<%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Юр. лицо";
    settings.Width = 147;
}).GetHtml()%>
<%Html.DevExpress().ComboBox(settings =>
  {
      settings.ReadOnly = true;
      //settings.Enabled = false;
      settings.Name = "IdLegalEntity";
      settings.Properties.ValueType = typeof(int);
      settings.Properties.TextField = "Name";
      settings.Width = 496;
      settings.Properties.ValueField = "IdLegalEntity";
      settings.Properties.EnableCallbackMode = true;
  }).BindList(leCol.GetFullDefinedLegalEntitiesByCustomerId(Model.IdCustomer)).Bind(Model.IdLegalEntity).GetHtml();
  //}).BindList(DB.GetFullDefinedLegalEntitiesByCustomerId(Model.IdCustomer)).Bind(Model.IdLegalEntity).GetHtml();
  %>

<%--<br />--%>

<%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Контакты";
    settings.Width = 147;
}).GetHtml()%>
<%Html.DevExpress().ComboBox(settings =>
  {
      settings.ReadOnly = true;
      //settings.Enabled = false;
      settings.Name = "IdContact";
      settings.Width = 496;
      settings.Properties.EnableCallbackMode = true;
      settings.Properties.ValueField = "IdContact";
      settings.Properties.ValueType = typeof(int);
      settings.Properties.Columns.Add("Name", Resourses.Name, Unit.Percentage(50));
      settings.Properties.Columns.Add("Phone", Resourses.Phone, Unit.Percentage(25));
      settings.Properties.Columns.Add("Email", Resourses.Email, Unit.Percentage(25));
      settings.Properties.DropDownWidth = 496;
      settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
  }).BindList(contactsCol.GetFullDefinedContactsByLegalEntityId(Model.IdLegalEntity)).Bind(Model.IdContact).GetHtml();
  //}).BindList(DB.GetFullDefinedContactsByLegalEntityId(Model.IdLegalEntity)).Bind(Model.IdContact).GetHtml();
  %>

<%--<br />--%>

<%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Адреса";
    settings.Width = 147;
}).GetHtml()%>
<%Html.DevExpress().ComboBox(settings =>
  {
      settings.ReadOnly = true;
      //settings.Enabled = false;
      settings.Name = "IdAddress";
      settings.Width = 496;
      settings.Properties.EnableCallbackMode = true;
      settings.Properties.ValueField = "IdAddress";
      settings.Properties.ValueType = typeof(int);
      //settings.Properties.Columns.Add("RegionNameLocalized", Resourses.Name, Unit.Percentage(25));
      //settings.Properties.Columns.Add("DistrictNameLocalized", Resourses.Phone, Unit.Percentage(25));
      //settings.Properties.Columns.Add("AreasNameLocalized", Resourses.Email, Unit.Percentage(25));
      //settings.Properties.Columns.Add("CityExt", Resourses.Email, Unit.Percentage(25));
      //settings.Properties.Columns.Add("Street", Resourses.Email, Unit.Percentage(25));
      //settings.Properties.Columns.Add("House", Resourses.Email, Unit.Percentage(25));
      //settings.Properties.Columns.Add("Phone", Resourses.Email, Unit.Percentage(25));
      settings.Properties.Columns.Add("RegionNameLocalized", Resourses.customerRegion);
      settings.Properties.Columns.Add("DistrictNameLocalized", Resourses.customerDistrict);
      settings.Properties.Columns.Add("AreasNameLocalized", Resourses.customerArea);
      settings.Properties.Columns.Add("SettlementsLocalized", Resourses.customerCity);
      settings.Properties.Columns.Add("Street", Resourses.customerStreet);
      settings.Properties.Columns.Add("House", Resourses.customerHouse);
      settings.Properties.Columns.Add("Phone", Resourses.customerPhone);
      settings.Properties.DropDownWidth = 496;
      settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
  }).BindList(addressesCol.GetAddressesByLegalEntityId(Model.IdLegalEntity)).Bind(Model.IdAddress).GetHtml();
  //}).BindList(DB.GetAddressesByLegalEntityId(Model.IdLegalEntity)).Bind(Model.IdAddress).GetHtml();
  %>
    
<%--<br />--%>

<table>
    <tr>
        <td>
            <%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Типы выезда";
    settings.Width = 245;
}).GetHtml()%>    
            <% Html.RenderPartial("TechnicRequestsVisitsTypesPartial"); %>
        </td>
        <td>
            <%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Вложения";
    settings.Width = 245;
}).GetHtml()%>    
            <% Html.RenderPartial("TechnicRequestsAttachmentsPartial"); %>
        </td>
    </tr>
</table>

<%--<br />--%>

<%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Системы";
    settings.Width = 147;
}).GetHtml()%>    
<% Html.RenderPartial("TechnicRequestsProductSystemsPartial"); %>

<%--<br />--%>

<%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Оборудование";
    settings.Width = 147;
}).GetHtml()%>    
<% Html.RenderPartial("TechnicRequestsEquipmentsPartial"); %>

<%--<br />--%>

<%:Html.DevExpress().Label(settings =>
{
    settings.ControlStyle.CssClass = "lable";
    settings.Text = "Комментарий";
    settings.Width = 147;
}).GetHtml()%>
<%:Html.DevExpress().Memo(settings =>
{
    settings.ReadOnly = true;
    settings.Name = "Comments";
    settings.Width = 496;
    settings.Height = 15;
}).Bind(Model.Comments).GetHtml()%>

</asp:Content>
